@extends('layouts.default')
@section('css')
    <link rel="stylesheet" href="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.css')}}">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
@stop

@section('content')
    <div class="row">
        <div class="col-12">
            
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">用户管理/ <a class="text-primary" href="{{url('admin/user/index')}}">用户列表</a></h3>
                </div>
                @include('layouts.message')
                <!-- /.card-header -->
                <div class="card-body">
                    <table id="example1" class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>用户昵称</th>
                            <th>用户头像</th>
                            <th>用户性别</th>
                            <th>是否会员</th>
                            <th>注册时间</th>
                            <th>登录类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($lists as $list)
                        <tr>
                            <td>{{ $list['id'] }}</td>
                            <td><image src="{{ $list['user_reg_time'] }}"></td>
                            <td>{{ $list['user_name'] }}</td>
                            <td>{{ $list['user_nickname'] }}</td>
                            <td>
                                @php
                                    if ( $list['user_sex']==1){echo '男';}else{echo '女';}
                                @endphp
                            </td>
                            <td>
                                @php
                                    if ( $list['is_vip']==1){echo '<span style="color:green;">是</span>';}else{echo '<span style="color:red;">否</span>';}
                                @endphp
                            </td>
                            <td>{{ $list['user_reg_time'] }}</td>
                            <td>{{ $list['login_type'] }}</td>

                            <td><a href="javascript:if(confirm('确认删除?')) location.href='{{url('admin/user/destroy',$list['id'])}}';" class="btn btn-danger">删除</a>
                                @if($list['is_disabled'] == 0)
                                    <a href="{{url('admin/user/disabled',$list['id'])}}" class="btn btn-info">禁用</a>
                                @else
                                    <a href="javascript:return false;" class="btn btn btn-default"  disabled="disabled">已禁用</a>
                                @endif
                                <a  class="btn btn-info" href="{{url('admin/user/rebateBenefit',$list['id'])}}">用户推荐</a>
                            </td>
                        </tr>
                        @endforeach
                        </tbody>
                        <tfoot>
                        <tr>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                        </tr>
                        </tfoot>
                    </table>

                </div>
                <!-- /.card-body -->
            </div>
            <!-- /.card -->
        </div>
        <!-- /.col -->
    </div>

@stop

@section('script')
    <script src="{{asset('admin-lte/plugins/datatables/jquery.dataTables.js')}}"></script>
    <script src="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.js')}}"></script>
    <script>
        $(function () {
            $("#example1").DataTable({
                "language"  : {
                    url :'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Chinese.json'
                },

            });

        });


    </script>
@stop